package com.tingyuge.base.arithmetic;

/**
 * Created by xiaodao
 * date: 2020/3/30
 */
public class Sort01 {

    public static int[] sort01(int... arr){
        int temp ;
        for (int i = 0; i <arr.length-1 ; i++) {
            for (int j = arr.length-1 ; j>i; j--) {

                if(arr[j-1] > arr[j]){
                    temp = arr[j-1];
                    arr[j-1] =  arr[j];
                    arr[j] =temp;

                }

            }

        }
        return arr;
    }

    public static void main(String[] args) {
        int[] arr = {1,4,10,3,3,5,2,89,45,34,20};
        for (int i : sort01(arr)) {
            System.out.print(i +"  ");

        }
    }
}
